export default function (data) {
    let tableString = '';
    let headerString = '';
    let tableArr = [];
    let hasopt = false;
    data.columns.forEach((item) => {
        headerString += `<td>${item.columnName}</td>`;
        tableArr.push(item.columnId);
    })
    let postString = ``;
    if (data.rows) {
        data.rows.forEach((item) => {
            let itemString = ``;
            for (let i = 0; i < tableArr.length; i++) {
                itemString += `<td>${item.columns[tableArr[i]].value}</td>`;
            }
            if (item.operations) {
                hasopt = true
                console.log(item.operations)
                let buttonString = ``;
                for (var key in item.operations) {
                    buttonString += `<button path="${item.operations[key]}" class="btn btn-default">${key}</button>`
                }
                buttonString = `<td>${buttonString}</td>`;
                itemString += buttonString;
                postString += `<tr>${itemString}</tr>`;
            }
        });
    }
    if (hasopt) {
        headerString += `<td>操作</td>`;
    }
    headerString = `<tr>${headerString}</tr>`
    tableString = headerString + postString;
    tableString = `<table class="table table-bordered ">${tableString}</table>`;
    return tableString;
}